@page "/"
@using Microsoft.Extensions.Configuration
@inject AuthenticationStateProvider AuthState
@inject IConfiguration Configuration

<h1>Welcome in Modern Architecture Shop.</h1>

<AuthorizeView>
  <Authorized>
    <h1>Hello, @_username</h1>
  </Authorized>

  <NotAuthorized>
    <div style="color:white; font-size: large" >
      Please login or register!<br/>
      Dummy User: bob <br />
      Dummy Password: bob <br />
    </div>
  </NotAuthorized>
</AuthorizeView>
@code
{ private string _username = "Anonymous User";

      protected override async Task OnInitializedAsync()
      {
        var state = await AuthState.GetAuthenticationStateAsync();

        _username =
          state.User.Claims
            .Where(c => c.Type.Equals("name"))
            .Select(c => c.Value)
            .FirstOrDefault() ?? string.Empty;

        await base.OnInitializedAsync();
      }
}
